feat: withRetry helper#343
Merged
Merged
Conversation
zhongkechen
requested changes
Apr 27, 2026
zhongkechen
reviewed
Apr 27, 2026
zhongkechen
reviewed
Apr 29, 2026
Closed
zhongkechen
reviewed
Apr 30, 2026
zhongkechen
reviewed
Apr 30, 2026
…for withRetry and withRetryAsync
zhongkechen
reviewed
Apr 30, 2026
…<DurableContext,Integer>
zhongkechen
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
Fixes: #355
Description
Add a public
WithRetryhelper that retries any durable operation (waitForCallback,invoke,waitForCondition, etc.) end-to-end with configurable backoff. Today users have to hand-roll a while loop with manualcontext.wait()backoff calls. This helper provides a single, replay-safe, well-tested primitive for that pattern, reusing the exact sameRetryStrategyshape developers already know fromStepConfig.New files:
withRetryConfig(sdk/.../config/) — Builder-pattern config holding theRetryStrategy(same type asStepConfig) andwrapInChildContext(defaults totrue). If RetryStrategy is not specified a default RetryStrategy is used.Key behaviors:
RetryStrategy/RetryDecisiontypes — zero new retry concepts.operation.execute()calls durable primitives,context.wait()handles backoff).SuspendExecutionExceptionandUnrecoverableDurableExecutionExceptionwithout retrying — these are internal SDK control flow signals.— wraps inrunInChildContext` by default for clean execution history grouping.Demo/Screenshots
N/A
Checklist
Testing
Unit Tests
yes
Integration Tests
yes
Examples
Yes.
yes